package xyz.robinbingo.effectivejava.chapter04.item18;

import cn.hutool.core.lang.Console;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import xyz.robinbingo.effectivejava.chapter02.item01.Dog;
import xyz.robinbingo.effectivejava.chapter04.item18.first.InstrumentedHashSet;
import xyz.robinbingo.effectivejava.chapter04.item18.second.InstrumentedSet;

import java.time.Instant;
import java.util.*;

/**
 * @author Robin
 * @date 2019/03/21 15:33
 **/
@RunWith(SpringRunner.class)
@SpringBootTest
public class Item18 {

    @Test
    public void test00() {
        InstrumentedHashSet<String> s = new InstrumentedHashSet<>();
        s.addAll(List.of("Snap", "Crackle", "Pop"));
        Console.log(s.getAddCount());
    }

    @Test
    public void test01() {
        Set<Instant> times = new InstrumentedSet<>(new TreeSet<>());
        Set<String> s = new InstrumentedSet<>(new HashSet<>());
    }

    @Test
    public void test02() {
        InstrumentedSet<Object> s = new InstrumentedSet<>(new HashSet<>());
        s.addAll(List.of("Snap", "Crackle", "Pop"));
        Console.log(s.getAddCount());
    }

    @Test
    public void test03() {
        Properties p = new Properties();
    }


    static void walk(Set<Dog> dogs) {
        InstrumentedSet<Dog> iDogs = new InstrumentedSet<>(dogs);
    }
}
